package com.iskny.framework.model;


import com.jfinal.plugin.activerecord.Model;

public class User extends Model<User> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7277899834043498918L;

	public final static User dao = new User();

	public static final String userPageKey = "userPageKey";
	/**
	 * check user loginname and password
	 * @param loginname
	 * @param password
	 * @param user set session attr when success
	 * @return @LoginResult
	 */
	public LoginResult checkUser(String loginname,String password, final User user){
		return LoginResult.success;
	}
	
	/**
	 * 根据登录名查询id
	 * @param loginname
	 * @return
	 */
	public Long getIdByLoginname(String loginname) {
		User u = dao.findFirst("select id from t_user where loginname=?",loginname);
		return u==null?-1:u.getLong("id");
	}

	public MyPage pageUser(int pageNumber, int pageSize) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
